{% extends 'home/base.html' %}

{% block container %}
    <section id="hotmovie" style="margin-top:76px">
        <div class="container">
            <div class="row wow fadeInRight" data-wow-delay="0.6s">
                <div class="row">
                    <iframe class="wow fadeIn" width="100%" height="375px" frameborder=0 scrolling=no src="{{ url_for('home.indexbanner') }}"></iframe>
                </div>
            </div>
        </div>
    </section>
    <!--热门电影-->
    <!--电影列表-->
    <section id="movielist">
        <div class="container">
            <div class="row wow fadeIn" data-wow-delay="0.6s">
                <div class="col-md-12 table-responsive">
                    <table class="table text-left table-bordered" id="movietags">
                        <tr>
                            <td style="width:10%;">电影标签</td>
                            <td style="width:90%;">
                                <a class="label label-info" href="{{ url_for('home.index', page=1) }}?tag_id=0&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-tag"></span>&nbsp;所有</a>
                                    &nbsp;
                                {% for tag in all_tag %}
                                    <a class="label label-info" href="{{ url_for('home.index', page=1) }}?tag_id={{ tag.id }}&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-tag"></span>&nbsp;{{ tag.name }}</a>
                                    &nbsp;
                                {% endfor %}
                        </tr>
                        <tr>
                            <td>电影星级</td>
                            <td>
                                <a class="label label-warning" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num=0&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-star"></span>&nbsp;所有</a>
                                &nbsp;
                                {% for star in all_star %}
                                    <a class="label label-warning" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ star.num }}&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-star"></span>&nbsp;{{ star.info }}</a>
                                    &nbsp;
                                {% endfor %}
                            </td>
                        </tr>
                        <tr>
                            <td>上映时间</td>
                            <td>
                                <a class="label label-default" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year=1&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-time">&nbsp;所有</span></a>
                                &nbsp;
                                <a class="label label-default" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ now_year }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-time">&nbsp;最近</span></a>
                                &nbsp;
                                {% for year in year_range %}
                                    <a class="label label-default" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ year }}&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-time">&nbsp;{{ year }}</span></a>
                                    &nbsp;
                                {% endfor %}
                                <a class="label label-default" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year=0&play_num={{ selected['play_num'] }}&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-time">&nbsp;更早</span></a>
                            </td>
                        </tr>
                        <tr>
                            <td>播放数量</td>
                            <td>
                                <a class="label label-success" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num=1&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-arrow-down">&nbsp;从高到底</span></a>
                                &nbsp;
                                <a class="label label-danger" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num=0&comment_num={{ selected['comment_num'] }}"><span class="glyphicon glyphicon-arrow-up">&nbsp;从低到高</span></a>
                            </td>
                        </tr>
                        <tr>
                            <td>评论数量</td>
                            <td>
                                <a class="label label-success" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num=1"><span class="glyphicon glyphicon-arrow-down">&nbsp;从高到底</span></a>
                                &nbsp;
                                <a class="label label-danger" href="{{ url_for('home.index', page=1) }}?tag_id={{ selected['tag_id'] }}&star_num={{ selected['star_num'] }}&time_year={{ selected['time_year'] }}&play_num={{ selected['play_num'] }}&comment_num=0"><span class="glyphicon glyphicon-arrow-up">&nbsp;从低到高</span></a>
                            </td>
                        </tr>
                    </table>
                </div>
                {% for movie in page_movies.items %}
                    <div class="col-md-3">
                        <div class="movielist text-center">
                            <!--<img data-original="holder.js/262x166"
                                     class="img-responsive lazy center-block" alt="">-->
                            <img src="{{ url_for('static', filename='media/' + movie.logo) }}" class="img-responsive center-block" alt="" style="height: 180px; width: 260px">
                            <div class="text-left" style="margin-left:auto;margin-right:auto;width:210px;">
                                <span style="color:#999;font-style: italic;">{{ movie.title }}</span><br>
                                <div>
                                    {% for i in range(movie.star) %}
                                        <span class="glyphicon glyphicon-star" style="color:#FFD119"></span>
                                    {% endfor %}
                                    {% for i in range(5 - movie.star) %}
                                        <span class="glyphicon glyphicon-star-empty" style="color:#FFD119"></span>
                                    {% endfor %}
                                </div>
                            </div>
                            <a href="{{ url_for('home.play', movie_id=movie.id, page=1) }}" class="btn btn-primary" target="_blank" role="button"><span class="glyphicon glyphicon-play"></span>&nbsp;播放</a>
                        </div>
                    </div>
                {% endfor %}
                <div class="col-md-12">
                    {% import 'home/pagination.html' as pg %}
                    {{ pg.render_pagination(page_movies, 'home.index') }}
                </div>
            </div>
        </div>
    </section>
{% endblock %}